<?php

namespace Regard\ProductsBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ProductType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', 'text')
            ->add('description', 'textarea')
            ->add('picture', 'file',array('data_class' => null,
											'property_path' => 'picture'))
            ->add('brandId', 'text', array( 'attr'=>array('style'=>'display:none;')))
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Regard\ProductsBundle\Entity\Product'
        ));
    }

    public function getName()
    {
        return 'regard_productsbundle_producttype';
    }
}
